package com.jcl.cloud.common.service.util;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;

public class PageOperation {


    private static String path = System.getProperty("user.dir");
    private static Logger logger = LoggerFactory.getLogger(PageOperation.class);

    //https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx
    public static String doPost2InboxRecentEngine(Map<String,String> argsMap,HttpClientContext context,int retryTimes){

        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        int times = 0;
        HttpPost httpPost = null;
        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost("https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("__EVENTTARGET", "btnProcess"));
            nvps.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
            nvps.add(new BasicNameValuePair("__LASTFOCUS", ""));
            nvps.add(new BasicNameValuePair("__VIEWSTATE", (String) argsMap.get("__VIEWSTATE")));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_keyword", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_area_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_funtype_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_sex", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_industry_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_major_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_hukou_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_positionapplied", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_keywordtype", "15"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_area_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_funtype_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_degreefrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_degreeto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_workyearfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_workyearto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_sex", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_industry_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_major_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_expectsalaryfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_expectsalaryto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_cursalaryfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_cursalaryto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_hukou_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_ownerhruid", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_label", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_titlelabel", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_company", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_division", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidKeywordCookie", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_allTxt", "\u001A\u001A\u001A\u001A\u001A\u001A\u001A0"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidmorelistheight", "126"));
            nvps.add(new BasicNameValuePair("pagerTopNew$ctl06", "50"));
            nvps.add(new BasicNameValuePair("cbxColumns$5", "TOPDEGREE"));
            nvps.add(new BasicNameValuePair("cbxColumns$11", "MOBIEPHONE"));
            nvps.add(new BasicNameValuePair("cbxColumns$13", "TOPSCHOOL"));
            nvps.add(new BasicNameValuePair("cbxColumns$14", "SOURCE"));
            nvps.add(new BasicNameValuePair("cbxColumns$16", "SENDDATE"));
            nvps.add(new BasicNameValuePair("hidShowCode", "0"));
            nvps.add(new BasicNameValuePair("hidAccessKey", (String) argsMap.get("hidAccessKey")));
            nvps.add(new BasicNameValuePair("hid_isafreshsearch", "1"));
            nvps.add(new BasicNameValuePair("hid_process", "2"));
            nvps.add(new BasicNameValuePair("hid_posttime", "180"));
            nvps.add(new BasicNameValuePair("hid_label", ""));
            nvps.add(new BasicNameValuePair("hid_labelTxt", ""));
            nvps.add(new BasicNameValuePair("hidSort", "SENDDATE"));
            nvps.add(new BasicNameValuePair("hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("hidDisplayType", "0"));
            nvps.add(new BasicNameValuePair("strSelectCols", "TOPDEGREE,MOBIEPHONE,TOPSCHOOL,SOURCE,SENDDATE"));
            nvps.add(new BasicNameValuePair("hidFolder", "EMP"));
            nvps.add(new BasicNameValuePair("hidSeqID", ""));
            nvps.add(new BasicNameValuePair("hidRefresh", "0"));
            nvps.add(new BasicNameValuePair("exportType", "Word"));
            nvps.add(new BasicNameValuePair("downloadType", "0"));
            nvps.add(new BasicNameValuePair("screen", "0"));
            nvps.add(new BasicNameValuePair("chk_intvplan", "on"));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("intvresult", "1"));
            nvps.add(new BasicNameValuePair("chk_offerplan", "on"));
            nvps.add(new BasicNameValuePair("offerresult", "1"));

            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));


            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();


            do {
                times++;
                logger.info(String.format("doPost2InboxRecentEngine  网络请求次数：%s",times));
                try {
                    response = httpClient.execute(httpPost, context);
                    resEntity = response.getEntity();
                    result = EntityUtils.toString(resEntity);
                    if(StringUtils.isBlank(result) || !result.contains("html")){
                        logger.error("doPost2InboxRecentEngine   响应结果有异常");
                    }else {
                        break;
                    }
                } catch (Exception e) {
                    logger.error("doPost2InboxRecentEngine   请求发送或者响应结果解析发生异常：", e);
                }


                if(times > retryTimes){
                    logger.info("doPost2InboxRecentEngine   重试超过retryTimes");
                    break;
                }
            } while (true);

        } catch (Exception e) {
            logger.error("doPost2InboxRecentEngine   执行发生异常：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }



    //https://ehire.51job.com/Candidate/SearchResumeNew.aspx
    public static String doGet2SearchResumeNew(HttpClientContext context){
        String url = "https://ehire.51job.com/Candidate/SearchResumeNew.aspx";


        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        int times = 0;
        HttpGet httpGet = null;
        HttpEntity resEntity = null;
        try {
             httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpGet.setHeader("Host","ehire.51job.com");
            httpClient = HttpClientUtil.getHttpClient();

            do {
                times++;
                logger.info("doGet2SearchResumeNew 发送网络请求的次数为："+times);
                try {
                    response = httpClient.execute(httpGet, context);
                    resEntity = response.getEntity();
                    result = EntityUtils.toString(resEntity);
                    if(StringUtils.isNotBlank(result)&&result.contains("html")){
                        logger.info("doGet2SearchResumeNew 请求返回的结果为：" + result);
                        break;
                    }
                } catch (Exception e) {
                    logger.error(String.format("doGet2SearchResumeNew 发生异常：%s",e.getMessage()),e);
                }


                if(times > 10){
                    logger.error("doGet2SearchResumeNew 发送网络请求发生错误重试超过次数");
                    break;
                }
                Thread.sleep(2000);
            } while (true);


        } catch (Exception e) {
            logger.error("doGet2SearchResumeNew 发生异常：" ,e);
        }finally {
            try {
                IOUtils.closeQuietly(response);
                httpGet.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }


        return result;
    }




    //https://ehire.51job.com/Ajax/Resume/GlobalSearchResumeIndexAjax.aspx
    public static String doPost2GlobalSearchResumeIndexAjax(Map<String,String> map ,HttpClientContext context ){
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String url = "https://ehire.51job.com/Ajax/Resume/GlobalSearchResumeIndexAjax.aspx";
        String result = "";
        int times = 0;
        HttpPost httpPost = null;
        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost(url);

            List<NameValuePair> nvps = new ArrayList<>();

            //设置参数
            for(String key:map.keySet()){
                nvps.add(new BasicNameValuePair(key, map.get(key)));
            }
            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));

            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "application/json, text/javascript, */*");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("X-Requested-With", "XMLHttpRequest");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", "https://ehire.51job.com/Candidate/SearchResumeNew.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            do {
                times++;
                logger.info("doPost2GlobalSearchResumeIndexAjax 发送网络请求的次数为："+times);
                try {
                    response = httpClient.execute(httpPost, context);
                    resEntity = response.getEntity();
                    result = EntityUtils.toString(resEntity);
                    if(StringUtils.isNotBlank(result)){
                        logger.info("doPost2GlobalSearchResumeIndexAjax 请求返回的结果为：" + result);
                        break;
                    }
                } catch (Exception e) {
                    logger.error(String.format("doPost2GlobalSearchResumeIndexAjax 发生异常：%s",e.getMessage()),e);
                }


                if(times > 6){
                    logger.error("doPost2GlobalSearchResumeIndexAjax 发送网络请求发生错误重试超过次数");
                    break;
                }
            } while (true);

        } catch (Exception e) {
            logger.error("doPost2GlobalSearchResumeIndexAjax 发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }



    //https://ehire.51job.com/Candidate/SearchResumeNew.aspx
    public static String doPost2SearchResumeNew(Map<String,String> map,HttpClientContext context){
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        String url = "https://ehire.51job.com/Candidate/SearchResumeNew.aspx";
        int times = 0;
        HttpPost httpPost = null;
        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost(url);
            List<NameValuePair> nvps = new ArrayList<>();
            String __EVENTTARGET = map.get("__EVENTTARGET");
            if(StringUtils.isNotBlank(__EVENTTARGET)){
                nvps.add(new BasicNameValuePair("__EVENTTARGET", __EVENTTARGET));
            }else {
                nvps.add(new BasicNameValuePair("__EVENTTARGET", "ctrlSerach$search_submit"));
            }

            nvps.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
            nvps.add(new BasicNameValuePair("__LASTFOCUS", ""));
            nvps.add(new BasicNameValuePair("__VIEWSTATE", map.get("__VIEWSTATE")));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_keyword_txt", map.get("keyword")));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_company_txt", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_area_input", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_area_hid", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_funtype_hid", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_expectsalaryf_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_expectsalaryt_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_industry_hid", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_wyf_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_wyt_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_df_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_dt_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_cursalaryf_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_cursalaryt_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_age_input", "年龄"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_agef_input", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_aget_input", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_expjobarea_input", "期望工作地"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_expjobarea_hid", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_forlang_input", "语言"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_fl_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_fllsabilityll_input", "不限"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_englishlevel_input", "英语等级"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_sex_input", "性别"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_major_input", "专业"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_major_hid", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_hukou_input", "户口"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_hukou_hid", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_rsmupdate_input", "近1年"));
            nvps.add(new BasicNameValuePair("ctrlSerach$search_jobstatus_input", "求职状态"));
            nvps.add(new BasicNameValuePair("send_cycle", "1"));
            nvps.add(new BasicNameValuePair("send_time", "7"));
            nvps.add(new BasicNameValuePair("send_sum", "10"));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidSearchValue", map.get("ctrlSerach$hidSearchValue")));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidKeyWordMind", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidRecommend", "#####"));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidWorkYearArea", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidDegreeArea", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidSalaryArea", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidCurSalaryArea", ""));
            nvps.add(new BasicNameValuePair("ctrlSerach$hidIsRecDisplay", "1"));
            nvps.add(new BasicNameValuePair("showselected", ""));
            nvps.add(new BasicNameValuePair("pagerTopNew$ctl06", "50"));
            nvps.add(new BasicNameValuePair("cbxColumns$0", "AGE"));
            nvps.add(new BasicNameValuePair("cbxColumns$1", "WORKYEAR"));
            nvps.add(new BasicNameValuePair("cbxColumns$2", "SEX"));
            nvps.add(new BasicNameValuePair("cbxColumns$3", "AREA"));
            nvps.add(new BasicNameValuePair("cbxColumns$4", "WORKFUNC"));
            nvps.add(new BasicNameValuePair("cbxColumns$5", "TOPDEGREE"));
            nvps.add(new BasicNameValuePair("cbxColumns$6", "LASTUPDATE"));
            nvps.add(new BasicNameValuePair("cbxColumns$7", "HUKOU"));
            nvps.add(new BasicNameValuePair("cbxColumns$10", "WORKINDUSTRY"));
            nvps.add(new BasicNameValuePair("cbxColumns$11", "TOPMAJOR"));
            nvps.add(new BasicNameValuePair("hidAccessKey", map.get("hidAccessKey")));
            nvps.add(new BasicNameValuePair("hidShowCode", "0"));
            nvps.add(new BasicNameValuePair("hidDisplayType", "1"));
            nvps.add(new BasicNameValuePair("hidEhireDemo", "hidUserID"));
            nvps.add(new BasicNameValuePair("hidCheckUserIds", map.get("hidCheckUserIds")));
            nvps.add(new BasicNameValuePair("hidCheckKey", map.get("hidCheckKey")));
            nvps.add(new BasicNameValuePair("hidEvents", ""));
            nvps.add(new BasicNameValuePair("hidNoSearchIDs", ""));
            nvps.add(new BasicNameValuePair("hidBtnType", ""));
            nvps.add(new BasicNameValuePair("hideMarkid", ""));
            nvps.add(new BasicNameValuePair("hidStrAuthority", "0"));
            nvps.add(new BasicNameValuePair("hidDownloadNum", map.get("hidDownloadNum")));
            nvps.add(new BasicNameValuePair("hidKeywordCookie", ""));
            nvps.add(new BasicNameValuePair("hidSearchTimestamp", map.get("hidSearchTimestamp")));
            nvps.add(new BasicNameValuePair("showGuide", ""));




            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));


            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            do {
                times++;
                logger.info("doPost2SearchResumeNew 发送网络请求的次数为："+times);
                try {
                    response = httpClient.execute(httpPost, context);
                    resEntity = response.getEntity();
                    result = EntityUtils.toString(resEntity);
                    if(StringUtils.isNotBlank(result)&&result.contains("html")){
                        logger.info("doPost2SearchResumeNew 请求返回的结果为：" + result);
                        break;
                    }
                } catch (Exception e) {
                    logger.error(String.format("doPost2SearchResumeNew 发生异常：%s",e.getMessage()),e);
                }


                if(times > 6){
                    logger.error("doPost2SearchResumeNew 发送网络请求发生错误重试超过次数");
                    break;
                }
            } while (true);

        } catch (Exception e) {
            logger.error("doPost2SearchResumeNew  发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }


    //https://ehire.51job.com/Candidate/ResumeView.aspx?hidUserID=107807854&hidEvents=23&pageCode=3&hidKey=c7c9b113a8960a9a89bc7bb6c05bd445
    public static String doGet2ResumeView(String url,HttpClientContext context){

        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        int times = 0;
        HttpGet httpGet = null;
        HttpEntity resEntity = null;
        try {
            httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpGet.setHeader("Referer","https://ehire.51job.com/Candidate/SearchResumeNew.aspx");



            httpGet.setHeader("Host","ehire.51job.com");

            httpClient = HttpClientUtil.getHttpClient();
            do {
                times++;
                logger.info("doGet2ResumeView 发送网络请求的次数为："+times);
                try {
                    response = httpClient.execute(httpGet, context);
                    resEntity = response.getEntity();
                    result = EntityUtils.toString(response.getEntity());
                    if(StringUtils.isNotBlank(result)&&result.contains("html")){
                        logger.info("doGet2ResumeView 请求返回的结果为：" + result);
                        break;
                    }
                } catch (Exception e) {
                    logger.error(String.format("doGet2ResumeView 发生异常：%s",e.getMessage()),e);
                }


                if(times > 6){
                    logger.error("doGet2ResumeView 发送网络请求发生错误重试超过次数");
                    break;
                }
            } while (true);

        } catch (Exception e) {
            logger.error("doGet2ResumeView 发生异常：" ,e);
        }finally {
            try {
                IOUtils.closeQuietly(response);
                httpGet.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }








































    public static String getNoReadResume(Map argsMap) {

        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String html = "";
        HttpPost httpPost = null;
        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost("https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("__EVENTTARGET", "btnProcess"));
            nvps.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
            nvps.add(new BasicNameValuePair("__LASTFOCUS", ""));
            nvps.add(new BasicNameValuePair("__VIEWSTATE", (String) argsMap.get("__VIEWSTATE")));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_keyword", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_area_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_funtype_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_sex", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_industry_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_major_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_hukou_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_positionapplied", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_keywordtype", "15"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_area_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_funtype_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_degreefrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_degreeto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_workyearfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_workyearto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_sex", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_industry_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_major_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_expectsalaryfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_expectsalaryto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_cursalaryfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_cursalaryto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_hukou_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_ownerhruid", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_label", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_titlelabel", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_company", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_division", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidKeywordCookie", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_allTxt", "\u001A\u001A\u001A\u001A\u001A\u001A\u001A0"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidmorelistheight", "126"));
            nvps.add(new BasicNameValuePair("pagerTopNew$ctl06", "50"));
            nvps.add(new BasicNameValuePair("cbxColumns$5", "TOPDEGREE"));
            nvps.add(new BasicNameValuePair("cbxColumns$11", "MOBIEPHONE"));
            nvps.add(new BasicNameValuePair("cbxColumns$13", "TOPSCHOOL"));
            nvps.add(new BasicNameValuePair("cbxColumns$14", "SOURCE"));
            nvps.add(new BasicNameValuePair("cbxColumns$16", "SENDDATE"));
            nvps.add(new BasicNameValuePair("hidShowCode", "0"));
            nvps.add(new BasicNameValuePair("hidAccessKey", (String) argsMap.get("hidAccessKey")));
            nvps.add(new BasicNameValuePair("hid_isafreshsearch", "1"));
            nvps.add(new BasicNameValuePair("hid_process", "2"));
            nvps.add(new BasicNameValuePair("hid_posttime", "180"));
            nvps.add(new BasicNameValuePair("hid_label", ""));
            nvps.add(new BasicNameValuePair("hid_labelTxt", ""));
            nvps.add(new BasicNameValuePair("hidSort", "SENDDATE"));
            nvps.add(new BasicNameValuePair("hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("hidDisplayType", "0"));
            nvps.add(new BasicNameValuePair("strSelectCols", "TOPDEGREE,MOBIEPHONE,TOPSCHOOL,SOURCE,SENDDATE"));
            nvps.add(new BasicNameValuePair("hidFolder", "EMP"));
            nvps.add(new BasicNameValuePair("hidSeqID", ""));
            nvps.add(new BasicNameValuePair("hidRefresh", "0"));
            nvps.add(new BasicNameValuePair("exportType", "Word"));
            nvps.add(new BasicNameValuePair("downloadType", "0"));
            nvps.add(new BasicNameValuePair("screen", "0"));
            nvps.add(new BasicNameValuePair("chk_intvplan", "on"));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("intvresult", "1"));
            nvps.add(new BasicNameValuePair("chk_offerplan", "on"));
            nvps.add(new BasicNameValuePair("offerresult", "1"));

            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));


            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();

            response = httpClient.execute(httpPost, (HttpClientContext) argsMap.get("context"));
            resEntity = response.getEntity();
            html = EntityUtils.toString(resEntity);
            System.out.println("获取未处理简历|未读 返回的信息如下：" + html);
        } catch (Exception e) {
            logger.error("获取未处理简历|未读发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return html;
    }



    //https://ehire.51job.com/InboxResume/InboxNavigator.aspx
    public static String doInboxNavigator(HttpClientContext context,String cookie){
        String url = "https://ehire.51job.com/InboxResume/InboxNavigator.aspx";


        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        int times = 0;
        try {
            HttpGet httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpGet.setHeader("Referer","https://ehire.51job.com/Navigate.aspx?ShowTips=11&PwdComplexity=N");

            httpGet.setHeader("Host","ehire.51job.com");
            //httpGet.setHeader("Cookie",cookie.substring(1));


            httpClient = HttpClientUtil.getHttpClient();

            do {
                times++;
                try {
                    response = httpClient.execute(httpGet, context);
                    result = EntityUtils.toString(response.getEntity());
                    if(StringUtils.isNotBlank(result)){
                        break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    Thread.sleep(2000);
                }

                if(times > 5){
                    break;
                }
            } while (true);


        } catch (Exception e) {
            logger.error("https://ehire.51job.com/InboxResume/InboxNavigator.aspx 发生异常：" ,e);
        }finally {
            try {
                response.close();
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


        return result;
    }



    public static String doGet2InboxRecentEngine(HttpClientContext context,int retryTimes){
        String url = "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx";


        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        int times = 0;
        try {
            HttpGet httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpGet.setHeader("Referer","https://ehire.51job.com/Navigate.aspx?ShowTips=11&PwdComplexity=N");

            httpGet.setHeader("Host","ehire.51job.com");
            httpClient = HttpClientUtil.getHttpClient();
            do {
                times++;
                logger.info(String.format("doGet2InboxRecentEngine  网络请求次数：%s",times));
                try {
                    response = httpClient.execute(httpGet, context);
                    result = EntityUtils.toString(response.getEntity());
                    if(StringUtils.isBlank(result) || !result.contains("html")){
                        logger.error("doGet2InboxRecentEngine   响应结果有异常");
                        Thread.sleep(1000);
                    }else {
                        break;
                    }

                } catch (Exception e) {
                    logger.error("doGet2InboxRecentEngine   请求发送或者响应结果解析发生异常：", e);
                    Thread.sleep(2000);
                }

                if(times > retryTimes){
                    logger.info("doGet2InboxRecentEngine   重试超过retryTimes");
                    break;
                }
            } while (true);


        } catch (Exception e) {
            logger.error("doGet2InboxRecentEngine  发生异常：" ,e);
        }finally {
            try {
                response.close();
                httpClient.close();
            } catch (IOException e) {
                logger.error("doGet2InboxRecentEngine  关闭资源发生异常：" ,e);
            }
        }
        return result;
    }










    //https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx
    public static String doInboxRecentEngine(Map<String,String> argsMap,HttpClientContext context){

        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String html = "";
        HttpPost httpPost = null;
        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost("https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("__EVENTTARGET", "btnProcess"));
            nvps.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
            nvps.add(new BasicNameValuePair("__LASTFOCUS", ""));
            nvps.add(new BasicNameValuePair("__VIEWSTATE", (String) argsMap.get("__VIEWSTATE")));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_keyword", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_area_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_funtype_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_sex", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_industry_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_major_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_hukou_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1_txt_positionapplied", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_keywordtype", "15"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_area_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_funtype_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_degreefrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_degreeto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_workyearfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_workyearto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_sex", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_industry_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_major_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_expectsalaryfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_expectsalaryto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_cursalaryfrom", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_cursalaryto", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_hukou_search", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_ownerhruid", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_label", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_titlelabel", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_company", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_division", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidKeywordCookie", ""));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hid_allTxt", "\u001A\u001A\u001A\u001A\u001A\u001A\u001A0"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("ctlSearchInboxEngine1$hidmorelistheight", "126"));
            nvps.add(new BasicNameValuePair("pagerTopNew$ctl06", "50"));
            nvps.add(new BasicNameValuePair("cbxColumns$5", "TOPDEGREE"));
            nvps.add(new BasicNameValuePair("cbxColumns$11", "MOBIEPHONE"));
            nvps.add(new BasicNameValuePair("cbxColumns$13", "TOPSCHOOL"));
            nvps.add(new BasicNameValuePair("cbxColumns$14", "SOURCE"));
            nvps.add(new BasicNameValuePair("cbxColumns$16", "SENDDATE"));
            nvps.add(new BasicNameValuePair("hidShowCode", "0"));
            nvps.add(new BasicNameValuePair("hidAccessKey", (String) argsMap.get("hidAccessKey")));
            nvps.add(new BasicNameValuePair("hid_isafreshsearch", "1"));
            nvps.add(new BasicNameValuePair("hid_process", "2"));
            nvps.add(new BasicNameValuePair("hid_posttime", "180"));
            nvps.add(new BasicNameValuePair("hid_label", ""));
            nvps.add(new BasicNameValuePair("hid_labelTxt", ""));
            nvps.add(new BasicNameValuePair("hidSort", "SENDDATE"));
            nvps.add(new BasicNameValuePair("hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("hidDisplayType", "0"));
            nvps.add(new BasicNameValuePair("strSelectCols", "TOPDEGREE,MOBIEPHONE,TOPSCHOOL,SOURCE,SENDDATE"));
            nvps.add(new BasicNameValuePair("hidFolder", "EMP"));
            nvps.add(new BasicNameValuePair("hidSeqID", ""));
            nvps.add(new BasicNameValuePair("hidRefresh", "0"));
            nvps.add(new BasicNameValuePair("exportType", "Word"));
            nvps.add(new BasicNameValuePair("downloadType", "0"));
            nvps.add(new BasicNameValuePair("screen", "0"));
            nvps.add(new BasicNameValuePair("chk_intvplan", "on"));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("intvresult", "1"));
            nvps.add(new BasicNameValuePair("chk_offerplan", "on"));
            nvps.add(new BasicNameValuePair("offerresult", "1"));

            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));


            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpPost, context);
            resEntity = response.getEntity();
            html = EntityUtils.toString(resEntity);
            System.out.println("获取未处理简历|未读 返回的信息如下：" + html);
        } catch (Exception e) {
            logger.error("获取未处理简历|未读发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return html;

    }



   //https://ehire.51job.com/Ajax/InboxResume/GlobalInboxCommonAjax.ashx
    public static String doGlobalInboxCommonAjax(Map<String,String> map,HttpClientContext context){
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        HttpPost httpPost = null;
        HttpEntity resEntity = null;
        String html = "";
        try {
            httpPost = new HttpPost("https://ehire.51job.com/Ajax/InboxResume/GlobalInboxCommonAjax.ashx");

            List<NameValuePair> nvps = new ArrayList<>();

            //设置参数
            for(String key:map.keySet()){
                nvps.add(new BasicNameValuePair(key, map.get(key)));
            }
            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));



            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "application/xml, text/xml, */*; q=0.01");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("X-Requested-With", "XMLHttpRequest");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            httpPost.setHeader("Referer", "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpPost, context);
            resEntity = response.getEntity();
            html = EntityUtils.toString(resEntity);
            logger.info(" /Ajax/InboxResume/GlobalInboxCommonAjax.ashx 返回的信息如下：" + html);
        } catch (Exception e) {
            logger.error("/Ajax/InboxResume/GlobalInboxCommonAjax.ashx 发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return html;
    }




     //eventNo不同

    //https://ehire.51job.com/Ajax/Common/GlobalActionLogAjax.ashx?logType=event&pageNo=24&memo=&eventNo=31&Key=3fe16708736ad4f269cfcf1156fca396&rnd=0.7503712594214644
    public static String doGlobalActionLogAjax(Map map,HttpClientContext context){

        String url = "https://ehire.51job.com/Ajax/Common/GlobalActionLogAjax.ashx?"
                +"logType="+map.get("logType")
                +"&pageNo="+map.get("pageNo")
                +"&memo="
                +"&eventNo="+map.get("eventNo")
                +"&Key="+map.get("Key")
                +"&rnd="+map.get("rnd");



        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        HttpGet httpGet = null;

        HttpEntity resEntity = null;
        try {
            httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","image/webp,image/apng,image/*,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            String Referer = (String)map.get("Referer");
            if(null != Referer){
                httpGet.setHeader("Referer",Referer);
            }else {
                httpGet.setHeader("Referer","https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            }


            httpGet.setHeader("Host","ehire.51job.com");

            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpGet, context);
            resEntity = response.getEntity();
            result = EntityUtils.toString(response.getEntity());


        } catch (Exception e) {
            logger.error("/Ajax/Common/GlobalActionLogAjax.ashx 发生异常：" ,e);
        }finally {
            try {
                IOUtils.closeQuietly(response);
                httpGet.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }


        return result;
    }




    //https://ehire.51job.com/Ajax/InboxResume/GlobalExportDivAjax.ashx
    public static String doGlobalExportDivAjax(Map<String,String> map,HttpClientContext context){
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String html = "";
        HttpPost httpPost = null;
        HttpEntity resEntity =null;
        try {
            httpPost = new HttpPost("https://ehire.51job.com/Ajax/InboxResume/GlobalExportDivAjax.ashx");

            List<NameValuePair> nvps = new ArrayList<>();
            //设置参数
            for(String key:map.keySet()){
                nvps.add(new BasicNameValuePair(key, map.get(key)));
            }
            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));



            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "application/xml, text/xml, */*; q=0.01");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("X-Requested-With", "XMLHttpRequest");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            httpPost.setHeader("Referer", "https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpPost, context);
            resEntity = response.getEntity();
            html = EntityUtils.toString(response.getEntity());
            logger.info(" /Ajax/InboxResume/GlobalExportDivAjax.ashx 返回的信息如下：" + html);
        } catch (Exception e) {
            logger.error("/Ajax/InboxResume/GlobalExportDivAjax.ashx 发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return html;
    }




//http://cvs.ehire.51job.com/Download.aspx?num=0.6934393051917513&lang=&ctmid=1646056&hruid=1962459&tokenid=14fdc11a-4238-49de-8388-fa62eea6&dbid=2&p=3&cf=&sg=115648ac927a8442&f=EMP&s=10448207540,10448207539,10448207537,10448207535,10448207533,10448185157,10448185155,10448142419,10448103231,10448037327,10448037147,10448037136,10448037132,10448026303,10448025320,10448022637&j=98402569,97722553,96886641,96943181,96986754,95854977,94732192,98901172,101656187,97442171,97629417,97316411,97063916,98901172,85003772,96849774&fa=Excel
    public static String doGet2Download(Map<String,String> map,HttpClientContext context){

        String url  = "http://cvs.ehire.51job.com/Download.aspx?"
                +"num="+map.get("num")
                +"&lang="+map.get("lang")
                +"&"+map.get("ctmid_sg")
                +"&f="+map.get("f")
                +"&s="+map.get("s")
                +"&j="+map.get("j")
                +"&fa="+map.get("fa");

        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        HttpGet httpGet = null;
        HttpEntity resEntity = null;
        int times = 0;
        try {
            httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            //httpGet.setHeader("Referer","https://ehire.51job.com/InboxResume/InboxRecentEngine.aspx");

            httpGet.setHeader("Host","cvs.ehire.51job.com");

            httpClient = HttpClientUtil.getHttpClient();


            do {
                times++;


                try {
                    response = httpClient.execute(httpGet, context);
                    resEntity = response.getEntity();
                    result = EntityUtils.toString(response.getEntity());
                    if(StringUtils.isNotBlank(result)&&result.contains("html")){
                        break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }


                if(times > 6){
                    break;
                }
                Thread.sleep(2000);
            } while (true);


        } catch (Exception e) {
            logger.error("doGet2Download  /Download.aspx? 发生异常：" ,e);
        }finally {
            try {
                IOUtils.closeQuietly(response);
                httpGet.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }


        return result;
    }


    public static void doPost2Download(Map<String,String> map, ConcurrentLinkedQueue qcwyFileQueue,HttpClientContext context) throws Exception{
        String url = map.get("url");
        String uuid = map.get("uuid");

        String __VIEWSTATE = map.get("__VIEWSTATE");
        String __VIEWSTATEGENERATOR = map.get("__VIEWSTATEGENERATOR");
        String hidExportSeqID = map.get("hidExportSeqID");
        String hidExportJobID = map.get("hidExportJobID");

        String Referer = map.get("Referer");



        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        boolean isDownLoadSucc = false;


        String fileStore = "/app/jcl-crawler/download/" + uuid + ".temp";
        File file = new File(fileStore);
        FileOutputStream fileout = new FileOutputStream(file);
        try {
            HttpPost httpPost = new HttpPost(url);
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("__VIEWSTATE", __VIEWSTATE));
            nvps.add(new BasicNameValuePair("__VIEWSTATEGENERATOR",__VIEWSTATEGENERATOR ));
            nvps.add(new BasicNameValuePair("hidExportFolder","EMP"));
            nvps.add(new BasicNameValuePair("hidExportFilter","0"));
            nvps.add(new BasicNameValuePair("hidExportSeqID",hidExportSeqID ));
            nvps.add(new BasicNameValuePair("hidExportJobID", hidExportJobID));
            nvps.add(new BasicNameValuePair("hidExportFormat", "Excel"));
            nvps.add(new BasicNameValuePair("hidExportPage","3" ));




            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));


            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");


            httpPost.setHeader("Referer", Referer);


            httpPost.setHeader("Origin", "http://cvs.ehire.51job.com");
            httpPost.setHeader("Host", "cvs.ehire.51job.com");

            httpClient = HttpClientUtil.getHttpClient();
            int times = 0;
            do {
                times++;
                logger.info(String.format("doPost2Download  执行网络请求次数：%s",times));
                try {
                    response = httpClient.execute(httpPost,context);
                    HttpEntity httpEntity = response.getEntity();
                    InputStream in = httpEntity.getContent();
                    Header[] typeHeadrer = response.getHeaders("Content-Type");
                    String contentTypes = typeHeadrer[0].getValue();
                    String temp = contentTypes.toUpperCase();

                    if (temp.indexOf("HTML") == -1 && temp.indexOf("TEXT") == -1 && temp.indexOf("JSON") == -1) {
                        // 不为文本类型时，就写流
                        int len = -1;
                        byte[] tmp = new byte[4096];
                        while ((len = in.read(tmp)) != -1) {
                            fileout.write(tmp, 0, len);
                        }
                        fileout.flush();
                        logger.info("doPost2Download 文件下载成功！");

                        isDownLoadSucc = true;

                        break;
                    }else {
                        String result = EntityUtils.toString(httpEntity);
                        logger.info(String.format("doPost2Download  返回的结果为：%s",result));
                        if(result.contains("简历不完整")){
                            logger.info("简历不完整，无法下载");
                            break;
                        }
                        Thread.sleep(3000);
                    }
                } catch (Exception e) {
                    Thread.sleep(1000);
                    logger.error(String.format("doPost2Download  执行网络请求发生异常：%s",e.getMessage()),e);
                }

                if(times > 4){
                    logger.error("doPost2Download  执行网络请求下载文件超过重试次数");
                    break;
                }
            } while (true);
        } catch (Exception e) {
            logger.error(String.format("doPost2Download 下载文件发生异常：%s",e.getMessage()),e);
        } finally {
            try {


                if (isDownLoadSucc) {
                    file.renameTo(new File("/app/jcl-crawler/xls/" + uuid + ".xls"));
                    //将抓取到的文件上报到队列
                    qcwyFileQueue.add(uuid);
                }else {
                    logger.info(String.format("任务号：%s   文件下载失败",uuid));
                }

                response.close();
                httpClient.close();
            } catch (Exception e) {
                logger.error(String.format("doPost2Download 下载文件回收资源发生异常：%s",e.getMessage()),e);
            }
        }

    }











    //https://ehire.51job.com/Jobs/JobSearchPost.aspx
    public static String doGet2JobSearchPost(Map<String,String> map,HttpClientContext context){

        String url  = map.get("url");


        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = null;
        String result = "";
        HttpGet httpGet = null;
        HttpEntity resEntity = null;
        try {
            httpGet = new HttpGet(url);

            httpGet.setHeader("Proxy-Authorization",HttpClientUtil.getAuthHeader());
            httpGet.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpGet.setHeader("Accept-Encoding","gzip, deflate, br");
            httpGet.setHeader("Accept-Language","zh-CN,zh;q=0.9");
            httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpGet.setHeader("Referer",map.get("Referer"));

            httpGet.setHeader("Host","ehire.51job.com");

            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpGet, context);
            resEntity = response.getEntity();
            result = EntityUtils.toString(resEntity);


        } catch (Exception e) {
            logger.error( String.format("doGet2JobSearchPost  发生异常：%s   请求url：%s" ,e,url));
        }finally {
            try {
                IOUtils.closeQuietly(response);
                httpGet.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }




    public static String  doPost2JobSearchPost(Map<String,String> map,HttpClientContext context) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String html = "";
        HttpPost httpPost = null;

        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost("https://ehire.51job.com/Jobs/JobSearchPost.aspx?IsHis=Y");
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("__EVENTTARGET", map.get("__EVENTTARGET")));
            nvps.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
            nvps.add(new BasicNameValuePair("__LASTFOCUS", ""));
            nvps.add(new BasicNameValuePair("__VIEWSTATE", map.get("__VIEWSTATE")));
            nvps.add(new BasicNameValuePair("txt_keyword", map.get("txt_keyword")));
            nvps.add(new BasicNameValuePair("hid_keywordtype", "CJOBEMAIL"));
            nvps.add(new BasicNameValuePair("txt_jobtype", ""));
            nvps.add(new BasicNameValuePair("hid_jobtype", ""));
            nvps.add(new BasicNameValuePair("txt_contractstatus", ""));
            nvps.add(new BasicNameValuePair("hid_contractstatus", ""));
            nvps.add(new BasicNameValuePair("txt_dlStatus", ""));
            nvps.add(new BasicNameValuePair("hid_dlStatus", "24"));
            nvps.add(new BasicNameValuePair("pagerTopNew$ctl06", "50"));
            nvps.add(new BasicNameValuePair("sex", "on"));
            nvps.add(new BasicNameValuePair("hidRePublishType", ""));
            nvps.add(new BasicNameValuePair("hidSyStudent", ""));
            nvps.add(new BasicNameValuePair("hid51LaiqQiang", ""));
            nvps.add(new BasicNameValuePair("hidJobID", ""));
            nvps.add(new BasicNameValuePair("hidShowMore", "0"));
            nvps.add(new BasicNameValuePair("hidSort", "CONFIRMDATE"));

            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));

            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", "https://ehire.51job.com/Jobs/JobSearchPost.aspx?IsHis=Y");
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpPost, context);
            resEntity = response.getEntity();
            html = EntityUtils.toString(resEntity);
            logger.info("doPost2JobSearchPost 返回的信息如下：" + html);
        } catch (Exception e) {
            logger.error("doPost2JobSearchPost发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return html;

    }











    //https://ehire.51job.com/Ajax/Resume/GlobalDownload.aspx
    public static String doPostToGlobalDownload(Map<String,String> map,HttpClientContext context){
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String html = "";
        HttpPost httpPost = null;

        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost("https://ehire.51job.com/Ajax/Resume/GlobalDownload.aspx");
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("doType", "SearchToCompanyHr"));
            nvps.add(new BasicNameValuePair("isNew", "1"));
            nvps.add(new BasicNameValuePair("OprType", "1"));
            nvps.add(new BasicNameValuePair("userId", map.get("userId")));
            nvps.add(new BasicNameValuePair("strWhere", ""));
            nvps.add(new BasicNameValuePair("markid", ""));
            nvps.add(new BasicNameValuePair("pageCode", "3"));


            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));

            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "application/xml, text/xml, */*; q=0.01");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            httpPost.setHeader("Referer", map.get("Referer"));
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            response = httpClient.execute(httpPost, context);
            resEntity = response.getEntity();
            html = EntityUtils.toString(resEntity);
            logger.info("doPostToGlobalDownload 返回的信息如下：" + html);
        } catch (Exception e) {
            logger.error("doPostToGlobalDownload发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return html;
    }




    //https://ehire.51job.com/Candidate/ResumeView.aspx?hidUserID=90822335&hidEvents=23&pageCode=3&hidKey=355fcbe72dfff3d4d21582e9ec32ef61
    public static String doPost2ResumeView(Map<String,String> map,HttpClientContext context){

        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String html = "";
        HttpPost httpPost = null;
        int times = 0;
        HttpEntity resEntity = null;
        try {
            httpPost = new HttpPost(map.get("url"));
            List<NameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("__EVENTTARGET", ""));
            nvps.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
            nvps.add(new BasicNameValuePair("__VIEWSTATE", ""));
            nvps.add(new BasicNameValuePair("resumeViewFolderType", "TEMP"));
            nvps.add(new BasicNameValuePair("hidMenuStatus", "0"));
            nvps.add(new BasicNameValuePair("hidUserID", map.get("hidUserID")));
            nvps.add(new BasicNameValuePair("hidFolder", "TEMP"));
            nvps.add(new BasicNameValuePair("hidSeqIDTemp", ""));
            nvps.add(new BasicNameValuePair("hidSeqID", map.get("hidSeqID")));
            nvps.add(new BasicNameValuePair("hidKeyWord", ""));
            nvps.add(new BasicNameValuePair("hidJobID", ""));
            nvps.add(new BasicNameValuePair("hidAccountID", map.get("hidAccountID")));
            nvps.add(new BasicNameValuePair("hidAllSeqIds", map.get("hidAllSeqIds")));
            nvps.add(new BasicNameValuePair("hidAllUserIds", map.get("hidAllUserIds")));
            nvps.add(new BasicNameValuePair("hidAllUserNames", ""));
            nvps.add(new BasicNameValuePair("hidAllAccountIds", map.get("hidAllAccountIds")));
            nvps.add(new BasicNameValuePair("hidCheckedUserIds", ""));
            nvps.add(new BasicNameValuePair("hidVisitedUserIds", ""));
            nvps.add(new BasicNameValuePair("hidCheckedSeqIds", ""));
            nvps.add(new BasicNameValuePair("hidCheckUserIds", map.get("hidCheckUserIds")));
            nvps.add(new BasicNameValuePair("hidCheckKey", map.get("hidCheckKey")));
            nvps.add(new BasicNameValuePair("hidIsRecommended", ""));
            nvps.add(new BasicNameValuePair("lang", ""));
            nvps.add(new BasicNameValuePair("hidWhere", ""));
            nvps.add(new BasicNameValuePair("hidType", ""));
            nvps.add(new BasicNameValuePair("hidDownLoad", "0"));
            nvps.add(new BasicNameValuePair("hidAllDownLoad", ""));
            nvps.add(new BasicNameValuePair("hidUserSex", ""));
            nvps.add(new BasicNameValuePair("hidCoid", ""));
            nvps.add(new BasicNameValuePair("exportType", "Word"));
            nvps.add(new BasicNameValuePair("downloadType", "0"));
            nvps.add(new BasicNameValuePair("screen", "0"));
            nvps.add(new BasicNameValuePair("rdbCustomize", "on"));
            nvps.add(new BasicNameValuePair("chk_intvplan", "on"));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("txt_intvplan_time", ""));
            nvps.add(new BasicNameValuePair("intvresult", "1"));
            nvps.add(new BasicNameValuePair("chk_offerplan", "on"));
            nvps.add(new BasicNameValuePair("offerresult", "1"));
            nvps.add(new BasicNameValuePair("hidShowCode", "0"));
            nvps.add(new BasicNameValuePair("hidAccessKey", map.get("hidAccessKey")));
            nvps.add(new BasicNameValuePair("hidischa", "0"));
            nvps.add(new BasicNameValuePair("hidupt", map.get("hidupt")));
            nvps.add(new BasicNameValuePair("hiddown", map.get("hiddown")));
            nvps.add(new BasicNameValuePair("oldnew", ""));
            nvps.add(new BasicNameValuePair("hidSearchTimestamp", ""));



            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));

            httpPost.setHeader("Proxy-Authorization", HttpClientUtil.getAuthHeader());
            httpPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate, br");
            httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
            httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
            httpPost.setHeader("Referer", map.get("Referer"));
            httpPost.setHeader("Origin", "https://ehire.51job.com");
            httpPost.setHeader("Host", "ehire.51job.com");


            httpClient = HttpClientUtil.getHttpClient();
            do {
                times++;
                try {
                    response = httpClient.execute(httpPost, context);
                    resEntity = response.getEntity();
                    html = EntityUtils.toString(resEntity);
                    logger.info("doPost2ResumeView 返回的信息如下：" + html);
                    if(StringUtils.isNotBlank(html) && html.contains("html")){
                        break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }

                if(times > 3){
                   break;
                }
            } while (true);
        } catch (Exception e) {
            logger.error("doPost2ResumeView发生的异常为：", e);
        } finally {
            try {
                IOUtils.closeQuietly(response);
                httpPost.releaseConnection();
                EntityUtils.consume(resEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return html;
    }


}
